package com.ruoyi.restaurant.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单明细表 tb_order_detail
 *
 * @author ruoyi
 */
public class OrderDetail extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 订单明细ID
     */
    @Excel(name = "明细ID", cellType = Excel.ColumnType.NUMERIC)
    private Long id;

    /**
     * 订单ID
     */
    @Excel(name = "订单ID")
    @NotNull(message = "订单ID不能为空")
    private Long orderId;

    /**
     * 菜品ID
     */
    @Excel(name = "菜品ID")
    @NotNull(message = "菜品ID不能为空")
    private Long menuId;

    /**
     * 菜品名称
     */
    @Excel(name = "菜品名称")
    @NotBlank(message = "菜品名称不能为空")
    private String menuName;

    /**
     * 菜品单价
     */
    @Excel(name = "单价")
    @NotNull(message = "菜品单价不能为空")
    private BigDecimal price;

    /**
     * 数量
     */
    @Excel(name = "数量")
    @NotNull(message = "数量不能为空")
    @Min(value = 1, message = "数量必须大于0")
    private Integer quantity;

    /**
     * 小计金额
     */
    @Excel(name = "小计")
    private BigDecimal subtotal;

    /**
     * 是否为加单菜品(0=点单,1=加单)
     */
    @Excel(name = "是否加单")
    private Integer isAdditional;

    /**
     * 出餐状态(0=待出餐,1=已出餐)
     */
    @Excel(name = "出餐状态")
    private Integer kitchenStatus;

    /**
     * 出餐时间
     */
    @Excel(name = "出餐时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date kitchenTime;

    @Excel(name = "创建时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public Long getMenuId() {
        return menuId;
    }

    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    public String getMenuName() {
        return menuName;
    }

    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getQuantity() {
        return quantity;
    }

    public void setQuantity(Integer quantity) {
        this.quantity = quantity;
    }

    public BigDecimal getSubtotal() {
        return subtotal;
    }

    public void setSubtotal(BigDecimal subtotal) {
        this.subtotal = subtotal;
    }

    public Integer getIsAdditional() {
        return isAdditional;
    }

    public void setIsAdditional(Integer isAdditional) {
        this.isAdditional = isAdditional;
    }

    public Integer getKitchenStatus() {
        return kitchenStatus;
    }

    public void setKitchenStatus(Integer kitchenStatus) {
        this.kitchenStatus = kitchenStatus;
    }

    public Date getKitchenTime() {
        return kitchenTime;
    }

    public void setKitchenTime(Date kitchenTime) {
        this.kitchenTime = kitchenTime;
    }

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("orderId", getOrderId())
                .append("menuId", getMenuId())
                .append("menuName", getMenuName())
                .append("price", getPrice())
                .append("quantity", getQuantity())
                .append("subtotal", getSubtotal())
                .append("isAdditional", getIsAdditional())
                .append("kitchenStatus", getKitchenStatus())
                .append("kitchenTime", getKitchenTime())
                .append("createTime", getCreateTime())
                .toString();
    }
}

